<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<img id="recive" style="width:200px; height: 300px;"/>
<div style="width:400px; height: 200px;border:1px solid red; overflow: scroll;" id="ctxt"></div>
<input id="msg"/> <input type="button" value="发送" onclick="sendMsg()">
<script>
    var client_socket = new WebSocket("ws://127.0.0.1:9999/onlineServer/sdkhfais");
    var image = document.getElementById("recive");

    client_socket.onmessage = function (info) {

        console.log("获得消息");

        image.src = info.data;
    }

    var msg_socket = new WebSocket("ws://127.0.0.1:9999/chatServer/sdkhfais");

    msg_socket.onmessage = function (info) {
        var ctxt = document.getElementById("ctxt");

        ctxt.innerHTML+=info.data+"<br />";
    }


    var sendMsg = function(){
        var msg = document.getElementById("msg");
        msg_socket.send(msg.value);

    }





</script>

</body>
</html>

</body>
</html>